﻿CREATE PROCEDURE [dbo].[smenu_TrackerRequest_CheckTrackerRemovalRequest]
(	@TrackerRequestID int
)
AS
SET NOCOUNT ON

DECLARE @Dir int SET @Dir = 1

IF EXISTS(SELECT tcl.* FROM
						(SELECT VIN FROM t_TrackerRequest WHERE ID = @TrackerRequestID)v
						 CROSS APPLY hist_Tracker_Car__Last(v.VIN) tcl
						 WHERE tcl.DateStamp > DATEADD(ww,-3,GETDATE())
	)
	SET @Dir = -1

EXEC smenu_TrackerRequest_Send @TrackerRequestID,@Dir,1

